package com.tianji.learning.controller.admin;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.entity.query.ReplyPageQuery;
import com.tianji.learning.entity.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Api(tags = "互动问答相关接口(管理端)")
@RestController
@RequestMapping("/admin/replies")
@RequiredArgsConstructor
public class InteractionReplyAdminController {

    private final IInteractionReplyService iInteractionReplyService;

    @ApiModelProperty("隐藏或显示评论")
    @PutMapping("/{id}/hidden/{hidden}")
    public void hiddenReply(@PathVariable("id") Long id, @PathVariable("hidden") Boolean hidden) {
        iInteractionReplyService.hiddenReply(id, hidden);
    }

    @ApiOperation("管理端分页查询回答或评论")
    @GetMapping("page")
    public PageDTO<ReplyVO> queryReplyPage(ReplyPageQuery query) {
        return iInteractionReplyService.queryReplyPage(query, true);
    }
}
